DischargePointInit Subroutine

public subroutine DischargePointInit(pointfile, path_out, time)

Initialize export of point site data

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pointfile

file containing coordinate of points

character(len=*), intent(in) :: path_out

path of output folder

type(DateTime), intent(in) :: time

start time


Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: err_io
integer(kind=short), public :: fileunit

Source Code

SUBROUTINE DischargePointInit &
!
( pointfile, path_out, time )

IMPLICIT NONE

!Arguments with intent (in):
CHARACTER (LEN = *), INTENT(IN) :: pointfile  !!file containing coordinate of points
CHARACTER (LEN = *), INTENT(IN) :: path_out  !!path of output folder
TYPE (DateTime),     INTENT(IN) :: time  !!start time

!local declarations
INTEGER (KIND = short) :: err_io
INTEGER (KIND = short) :: fileunit

!-------------------------end of declarations----------------------------------

timePointExport = time

!open point file
fileunit = GetUnit ()
OPEN ( unit = fileunit, file = pointfile(1:LEN_TRIM(pointfile)), &
      status='OLD', iostat = err_io )

IF ( err_io /= 0 ) THEN
	!file does not exist
    CALL Catch ('error', 'DischargeRouting', 'out point file does not exist')
END IF 

!Read metadata
CALL ReadMetadata (fileunit, sites)

!check dt
IF (.NOT. ( MOD ( sites % timeIncrement, dtDischargeRouting ) == 0 ) ) THEN
  CALL Catch ('error', 'DischargeRouting', &
              'dt out sites must be multiple of dtDischargeRouting ')
END IF

CLOSE ( fileunit )

!create virtual network and initialize file for output

fileUnitPointDischarge = GetUnit ()
OPEN ( unit = fileUnitPointDischarge, &
    file = TRIM(path_out) // 'point_discharge.fts' )
    
CALL CopyNetwork ( sites, sitesDischarge )

sitesDischarge % description = 'discharge data exported from FEST'

sitesDischarge % unit = 'm3/s'

sitesDischarge % offsetZ = 0.

CALL WriteMetadata ( network = sitesDischarge, &
                fileunit = fileUnitPointDischarge )

CALL WriteData (sitesDischarge, fileUnitPointDischarge, .TRUE.)    

! destroy sites
CALL DestroyNetwork ( sites )

RETURN
END SUBROUTINE DischargePointInit